import {ref,toRefs,onMounted} from '@vue/composition-api'
import {
    activityStatistics,
} from "@/api/activity";
export default function ($router){
    const info =ref({})
    onMounted(async ()=>{
        await getItemJyToken()
    })
    //获取用户信息
    const getItemJyToken = async()=>{
        if (!localStorage.getItem("jyToken")) {
                return $router.replace({
                  name: "Login",
                  query: { dirUrlName: "MyActivity" },
                });
        }
       await getInfoData()
    }
      const getInfoData=()=> {
        activityStatistics().then((res) => {
          if (res.code === 0) {
              info.value=res.data
          }
        });
      }
      return {
          info,
          getItemJyToken
      }
}
